/**
 * 对话路由
 * 处理对话相关的API请求
 */
const express = require('express');
const router = express.Router();
const { protect } = require('../middleware/authMiddleware');
const { 
  getConversations, 
  getConversationById, 
  getConversationMessages,
  markConversationAsRead, 
  deleteConversation 
} = require('../controllers/conversationController');

// 路由配置
router.route('/')
  .get(protect, getConversations); // 获取用户所有对话

router.route('/:conversationId')
  .get(protect, getConversationById) // 获取特定对话
  .delete(protect, deleteConversation); // 删除对话

router.route('/:conversationId/messages')
  .get(protect, getConversationMessages); // 获取对话中的消息

router.route('/:conversationId/read')
  .put(protect, markConversationAsRead); // 标记对话为已读

module.exports = router; 